﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using KC.Framework.Base;

namespace KC.Domain.Core.IRepository
{
    public interface IDbTreeRepository<K> : IDbRepository<K> where K : TreeNode<K>
    {
        List<K> GetAllTreeNodeWithNestChild();
        Task<List<K>> GetAllTreeNodeWithNestChildAsync();
        List<K> GetAllTreeNodeWithNestChildByFilter(Expression<Func<K, bool>> predicate);
        Task<List<K>> GetAllTreeNodeWithNestChildByFilterAsync(Expression<Func<K, bool>> predicate);
        List<K> GetNodeListContainNestChildByFilter(Expression<Func<K, bool>> predicate);
        List<K> GetNodeListContainNestChildByParentId(int? parentId);
        Task<List<K>> GetNodeListContainNestChildByParentIdAsync(int? parentId);
        List<K> GetTreeNodesWithNestParentAndChildByFilter(Expression<Func<K, bool>> predicate);
        Task<List<K>> GetTreeNodesWithNestParentAndChildByFilterAsync(Expression<Func<K, bool>> predicate);
        List<K> GetTreeNodesWithNestParentAndChildById(int id);
        Task<List<K>> GetTreeNodesWithNestParentAndChildByIdAsync(int id);
        List<K> GetTreeNodesWithNestParentAndChildByTreeCode(string treeCode);
        Task<List<K>> GetTreeNodesWithNestParentAndChildByTreeCodeAsync(string treeCode);

        K GetTreeNodeWithNestChildById(int id);
        Task<K> GetTreeNodeWithNestChildByIdAsync(int id);

        bool UpdateExtendFields();
        Task<bool> UpdateExtendFieldsAsync();
        bool UpdateExtendFieldsByFilter(Expression<Func<K, bool>> predicate);
        Task<bool> UpdateExtendFieldsByFilterAsync(Expression<Func<K, bool>> predicate);
    }

}
